package com.learn.springboot3;

import cn.hutool.crypto.digest.MD5;

import java.io.*;
import java.util.ArrayList;
import java.util.Comparator;

/**
 * ClassName: test
 * Package: com.learn.springboot3
 * Description:
 *
 * @Author jiangcheng
 * @Create 2024/9/27 15:46
 * @Version 1.0
 */

public class test {
    public static void main(String[] args) throws IOException {
//        File file = new File("C:\\Users\\jiang\\Downloads\\01-需求到开发清单的旅程 v1.0.pdf");
//        ArrayList<String> strings = new ArrayList<>();
//        String s = MD5.create().digestHex(file);
//        System.out.println(s);
//        File path = new File("D:\\temp\\file");
//        File[] files = path.listFiles();
//
//        for (File file1 : files) {
//            System.out.println("file1 = " + file1.getName());
//            strings.add(file1.getName());
//        }
//        strings.sort(((o1, o2) -> {
//            String[] split = o1.split("@");
//            String s1 = split[split.length-1];
//            String[] split1 = o2.split("@");
//            String s2 = split1[split1.length-1];
//            Integer i = Integer.parseInt(s1);
//            Integer i1 = Integer.parseInt(s2);
//          return  i- i1;
//        }));
//        files.clone();
//        OutputStream outputStream = new FileOutputStream("D:\\temp\\file1\\3.9.9-bin.tar.gz");
//
//
//
//        for (int i = 0; i < strings.size(); i++) {
//            File file1 = new File("D:\\temp\\file\\"+strings.get(i));
//            InputStream inputStream = new FileInputStream(file1);
//            byte[] bytes = inputStream.readAllBytes();
//            outputStream.write(bytes);
//            inputStream.close();
//            boolean delete = file1.delete();
//        }
//        outputStream.close();

//        System.out.println(MD5.create().digestHex(new File("D:\\temp\\file1\\3.9.9-bin.tar.gz")));
    }
}
